﻿using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.service;
using DXApplicationTangche.UC.圣同润.merchant;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 广州爱特安为科技.UC.圣同润.客服.售后
{
    public partial class Form售后二次审核详情 : DevExpress.XtraEditors.XtraForm
    {
        private RefundAuditDataDao refundAuditDataDao;
        private String product_id { get; set; }

        public Form售后二次审核详情(String order_sn,String product_id)
        {
            InitializeComponent();
            this.product_id = product_id;
            this.refundAuditDataDao = MerchantService.getRefundAuditByOrderSn(order_sn);
            this.refresh();
        }
        public Form售后二次审核详情(RefundAuditDataDao refundAuditDataDao)
        {
            InitializeComponent();
            this.refundAuditDataDao = refundAuditDataDao;
            this.refresh();
        }

        private void refresh()
        {
            //  商品详情
            if (!String.IsNullOrEmpty(this.product_id))
            {
                ProductDao productDao = MerchantService.getProductById(long.Parse(this.product_id));
                try { this.pictureBox商品图片.Image = FileService.GetImageByUrl(productDao.image); } catch { }
                this.textBox商品价格.Text = productDao.price;
                this.textBox商品库存.Text = productDao.stock.ToString();
            }
            else
            {
                String product_image = this.refundAuditDataDao.product_pic.Replace("\\,\\.*", "");
                try { this.pictureBox商品图片.Image = FileService.GetImageByUrl(product_image); } catch { }
            }
            //  二次审核详情
            this.textBox退回单号.Text = this.refundAuditDataDao.orderId;
            this.textBox下单时间.Text = this.refundAuditDataDao.addTime.ToString("yyyy-MM-dd");
            this.textBox售后申请时间.Text = this.refundAuditDataDao.apply_time.ToString("yyyy-MM-dd");
            this.textBox一线处理方案.Text = this.refundAuditDataDao.processing_scheme;
            this.textBox退款状态.Text = this.refundAuditDataDao.refund_status_apply;
            this.textBox实际支付.Text = this.refundAuditDataDao.pay_price;
            this.textBox客户回传状态.Text = this.refundAuditDataDao.customer_return_status;
            this.textBox寄回揽收状态.Text = this.refundAuditDataDao.send_back_status_desc;
            this.textBox补偿状态.Text = this.refundAuditDataDao.compensation_status;
            this.textBox补偿方式.Text = this.refundAuditDataDao.compensation_method;
            this.textBox操作人.Text = this.refundAuditDataDao.operationStaff;
            this.textBox商品信息.Text = this.refundAuditDataDao.product_infos;
            this.textBox品牌商.Text = this.refundAuditDataDao.supplier_name;
            this.textBox寄回物流公司.Text = this.refundAuditDataDao.return_express_company;
            this.textBox寄回物流单号.Text = this.refundAuditDataDao.return_express_order_no;
            //  订单记录
            this.gridControl订单记录.DataSource = this.refundAuditDataDao.statusInfo.order_data;
            this.gridView订单记录.RefreshData();
            //  售后记录
            this.gridControl售后记录.DataSource = this.refundAuditDataDao.statusInfo.second_order_data;
            this.gridView售后记录.RefreshData();
        }
    }
}